﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ExportToRTR.YAML.Vec3D
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using Tecnomatix.Engineering;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Serialization;


namespace DnProcessSimulateCommands.ExportToRTR.YAML;

public class Vec3D : IYamlConvertible
{
  private double[] vec_ = new double[3];

  public void Read(IParser parser, Type expectedType, ObjectDeserializer nestedObjectDeserializer)
  {
    this.vec_ = (double[]) nestedObjectDeserializer.Invoke(typeof (double[]));
  }

  public void Write(IEmitter emitter, ObjectSerializer nestedObjectSerializer)
  {
    emitter.Emit((ParsingEvent) new SequenceStart(AnchorName.op_Implicit((string) null), TagName.op_Implicit((string) null), false, (SequenceStyle) 2));
    nestedObjectSerializer.Invoke((object) this.vec_[0], (Type) null);
    nestedObjectSerializer.Invoke((object) this.vec_[1], (Type) null);
    nestedObjectSerializer.Invoke((object) this.vec_[2], (Type) null);
    emitter.Emit((ParsingEvent) new SequenceEnd());
  }

  public Vec3D()
  {
  }

  public Vec3D(double[] value) => this.vec_ = value;

  public Vec3D(TxVector vec)
  {
    this.vec_ = new double[3]{ vec.X, vec.Y, vec.Z };
  }

  internal TxVector ToTxVector() => new TxVector(this.vec_[0], this.vec_[1], this.vec_[2]);
}
